package entities.base;

import it.randomtower.engine.entity.Entity;

import org.newdawn.slick.Color;
import org.newdawn.slick.Image;

/**
 * Ein Block ist ein 32px x 32px Block in der Welt, der verschiedene Grafiken,
 * Farben und Eigenschaften haben kann.
 * 
 * @author Benjamin
 */
public abstract class Block extends Entity {

	private Color color = null;

	public Block(float x, float y, int width, int height, boolean isSolid) {
		super(x, y);

		depth = 1;
		name = "Block_" + hashCode();

		addType("BlockType");
		if (isSolid) {
			addType(SOLID);
			setHitBox(0, 0, width, height);
		}
	}

	public Block(float x, float y) {
		this(x, y, 32, 32, true);
	}

	public Block(float x, float y, int width, int height) {
		this(x, y, width, height, true);
	}

	public Block(float x, float y, boolean isSolid) {
		this(x, y, 32, 32, isSolid);
	}

	/**
	 * @return the color
	 */
	public Color getColor() {
		return color;
	}

	/**
	 * @param c
	 *            the color to set
	 */
	public void setColor(Color c) {
		this.color = c;
		currentImage.setColor(Image.TOP_LEFT, c.r, c.g, c.b, 1);
		currentImage.setColor(Image.TOP_RIGHT, c.r, c.g, c.b, 1);
		currentImage.setColor(Image.BOTTOM_LEFT, c.r, c.g, c.b, 1);
		currentImage.setColor(Image.BOTTOM_RIGHT, c.r, c.g, c.b, 1);
	}

}
